package com.chao.sentinel.controller;

import com.chao.sentinel.client.FeignTestClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : Rookie
 * @description : 降级
 * @date : 2022/4/6
 */
@RestController
@RequestMapping("/degrade")
public class FlowDegradeController {

    @Autowired
    private FeignTestClient feignTestClient;

    @GetMapping("/test")
    public String test() throws InterruptedException {
            Thread.sleep(3000);
        return "收到一条消息";
    }

    @GetMapping("/feign/test")
    public String getOrder(@RequestParam String orderId){
        return feignTestClient.getOrder(orderId);
    }
}
